package day10Stringdemo;

public class Demo5 {
    public static void main(String[] args) {
        String talk = "你玩的真好，以后别玩了，TMD,SB,MLGB,CNM";

        //建一个敏感词库  用数组查找替换
        String[] arr = {"TMD","CNM","SB","MLGB"};

        for (int i = 0; i < arr.length; i++) {
            //字符串替换
             talk = talk.replace(arr[i], "***");
        }
        //String str = talk.replace("TMD", "***");
        System.out.println(talk);
    }
}
